package webcert.ch01.ex0105;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class LifeCycle extends HttpServlet {

    {
        System.out.println("Loading servlet class...");
    }

    public LifeCycle() {
        System.out.println("Instantiation servlet class...");
    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("Executing service class...");
    }

    @Override
    public void init() throws ServletException {
        super.init();
        System.out.println("Initializing servlet class...");

    }

    @Override
    public void destroy() {
        super.destroy();    //To change body of overridden methods use File | Settings | File Templates.
        System.out.println("Destroying servlet class...");

    }
}
